home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist6.3 / ViewKit_dev.idb / usr / include / Vk / VkApp.h.z / VkApp.h
Encoding:
C/C++ Source or Header  |  1996-09-20  |  6.6 KB  |  183 lines

  1. ////////////////////////////////////////////////////////////////////////////////
  2. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  3. //                                                                            //
  4. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  5. // the contents of this file may not be disclosed to third parties, copied    //
  6. // or duplicated in any form, in whole or in part, without the prior written  //
  7. // permission of Silicon Graphics, Inc.                                       //
  8. //                                                                            //
  9. // RESTRICTED RIGHTS LEGEND:                                                  //
  10. // Use,duplication or disclosure by the Government is subject to restrictions //
  11. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  12. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  13. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  14. // rights reserved under the Copyright Laws of the United States.             //
  15. //                                                                            //
  16. ////////////////////////////////////////////////////////////////////////////////
  17.  
  18. #ifndef VKAPP_H
  19. #define VKAPP_H
  20.  
  21. //////////////////////////////////////////////////////////////////////////////////////////
  22. // VkApp.h
  23.  
  24. #include <X11/Xlib.h>
  25. #include <Vk/VkComponent.h>
  26. #include <Vk/VkComponentList.h>
  27.  
  28. class VkApp;
  29. class VkSimpleWindow;
  30. class VkBusyDialog;
  31. class VkDialogManager;
  32. class VkCursorList;
  33.  
  34. extern VkApp             *theApplication;
  35. extern unsigned int       VkDebugLevel;
  36.  
  37. // VkApp class
  38.  
  39. class VkApp : public VkComponent {
  40.  
  41.     friend class VkSimpleWindow;
  42.     friend class VkQuickHelp;
  43.  
  44.   public:
  45.  
  46.     VkApp(char             *appClassName,
  47.       int              *arg_c, 
  48.       char            **arg_v,
  49.       XrmOptionDescRec *optionList       = NULL,
  50.       int               sizeOfOptionList = 0);
  51.  
  52.     VkApp(Widget w);  // Test
  53.  
  54.      static const int ViewKitMajorRelease;
  55.      static const int ViewKitMinorRelease;
  56.      static const char ViewKitReleaseString[];
  57.  
  58.      void   setVersionString(const char *str);
  59.      const char  *versionString() { return _versionString;}
  60.  
  61.      virtual      ~VkApp();
  62.  
  63.     // An application should not need to override run().  If there really
  64.     // is required extra event handling, it is better to use
  65.     //         run(Boolean (*appEventHandler)(XEvent &))
  66.     // See "man VkApp" for further information.
  67.     virtual void run();                // Binary compatibility
  68.     void run(Boolean (*appEventHandler)(XEvent &));    // App extra events
  69.     void run_first();                // Stuff before the event loop
  70.     virtual void terminate(int status = 0);
  71.  
  72.     // An application should not need to override handlePendingEvents().  If
  73.     // there really is required extra event handling, it is better to use
  74.     //         handlePendingEvents(Boolean (*appEventHandler)(XEvent &))
  75.     // See "man VkApp" for further information.
  76.             void handlePendingEvents (Boolean (*appEventHandler)(XEvent &));
  77.     virtual void handlePendingEvents();
  78.     virtual void quitYourself();
  79.             void handleRawHelpEvent(XEvent *event);
  80.     virtual void handleRawEvent(XEvent *event);
  81.     static  void useSchemes(const char*);
  82.  
  83.   
  84.     void         setMainWindow(VkSimpleWindow *);  // Let the app know that a particular "window" is the main one
  85.  
  86.     // Operations on all windows
  87.  
  88.     virtual void raise();
  89.     virtual void lower();
  90.     virtual void iconify();
  91.     virtual void open();
  92.     virtual void show();
  93.     virtual void hide();
  94.  
  95.     void    startupIconified(const Boolean flag) { _startupIconified = flag; }
  96.  
  97.     virtual Cursor  busyCursor();
  98.     virtual Cursor  normalCursor();
  99.     void    setNormalCursor(const Cursor);
  100.     void    setBusyCursor(const Cursor);
  101.     void    setBusyCursor(VkCursorList *);
  102.     void    showCursor(const Cursor);
  103.     void    setAboutDialog(VkDialogManager *d) { _aboutDialog = d; }
  104.     VkDialogManager*  aboutDialog() { return (_aboutDialog); }
  105.  
  106.     void    setStartupDialog(VkDialogManager *d) { _startupDialog = d; }
  107.     VkDialogManager*  startupDialog() { return (_startupDialog); }
  108.  
  109.     virtual void         busy(const char *msg = NULL,     VkSimpleWindow *parent = NULL);
  110.     virtual void         veryBusy(const char *msg = NULL, VkSimpleWindow *parent = NULL);
  111.     virtual void         notBusy();
  112.  
  113.     virtual void         progressing(const char *msg = NULL);
  114.  
  115.     void  setBusyDialog(VkBusyDialog *);
  116.  
  117.     XtAppContext        appContext() const { return _appContext;}
  118.     char               *name() const;
  119.     Display            *display() const { return _dpy;}
  120.     char              **argv() const { return _argv; }
  121.     char               *argv(int index);
  122.     int                 argc() const { return _argc;}
  123.     char               *applicationClassName() const { return _applicationClassName;}
  124.     VkSimpleWindow     *mainWindow() const;
  125.     char               *shellGeometry() const;  // The size of the hidden shell
  126.     Boolean             startupIconified() const { return _startupIconified; }
  127.     Boolean             isBusy() { return (_busyCounter > 0); }
  128.     virtual const char *className();
  129.  
  130.     static void setFallbacks(char **);
  131.  
  132.     VkComponentList *windowList();
  133.  
  134.   protected:
  135.  
  136.     VkComponentList    _winList;
  137.     int parseCommandLine(XrmOptionDescRec  *, Cardinal); 
  138.     virtual void afterRealizeHook();
  139.     Boolean _quitSemaphore;
  140.  
  141.     VkCursorList  *_busyCursorList;
  142.  
  143.   // helpEnabled() is called by the QuickHelp consructor.  It could be
  144.   // public, but it is an internal imlementation detail tht we do not want
  145.   // user apps to use.  So we make VkQuickHelp a friend of VkApp.
  146.     void helpEnabled (Boolean);
  147.  
  148.   private:
  149.  
  150.     static  XtResource _resSpec[];
  151.     static  String _resources[];
  152.  
  153.     static Cursor _busyCursor;
  154.     static Cursor _normalCursor;
  155.  
  156.     VkDialogManager *_aboutDialog;
  157.     VkDialogManager *_startupDialog;
  158.  
  159.     void        createCursors();
  160.     Boolean     manageShowHide();
  161.  
  162.     // Various data needed by other parts of an application
  163.  
  164.  
  165.     char              **_argv;
  166.     int                 _argc;
  167.     char               *_shellGeometry;
  168.     VkSimpleWindow     *_mainWindow;
  169.     char               *_versionString;
  170.     Display            *_dpy;
  171.     XtAppContext        _appContext;
  172.     char               *_applicationClassName;
  173.     void                 addWindow ( VkSimpleWindow * );
  174.     void                 removeWindow( VkSimpleWindow * );
  175.     int                 _busyCounter;
  176.     Boolean             _startupIconified;
  177.     Boolean             _usePopupPlanes;
  178.     static const char  *_useSchemes;
  179.     static String      *_fallbacks;
  180. }; 
  181.  
  182. #endif /* VKAPP_H */
  183.